import React from 'react'


import { BrowserRouter as Router, Route, Link,Redirect } from 'react-router-dom'

// 导入首页、城市选择、地图组件
import Home from './pages/Home'
import CityList from './pages/CityList'
import Map from './pages/Map'

function App() {
  return (
    <Router>
      <div className="App">
        {/* 默认路由匹配时，跳转home，实现路由重定向 */}
        {/* render属性:是一个函数prop,用于指定要渲染的内容 
            Redirect 组件用于实现路由重定向,to 属性指定要跳转的路由地址*/}
          <Route path="/" exact render={()=> <Redirect to="/home"/>}></Route>
        {/* 配置路由 */}
        {/* Home 组件是父组件的内容 */}
        <Route path="/home"  component={Home}/>
        <Route path="/citylist"  component={CityList}/>
        <Route path="/map" component={Map}/>
      </div>
    </Router>
  );
}

export default App;
